package com.njym.java.security.app.rest;

import com.njym.java.security.app.biz.LoveLifeBiz;
import com.njym.java.security.app.entity.LoveLife;
import com.njym.java.security.common.rest.BaseController;
import com.njym.java.security.common.util.ResponseUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import tk.mybatis.mapper.entity.Example;

import java.util.List;


@Controller
@RequestMapping("loveLife")
public class LoveLifeController extends BaseController<LoveLifeBiz,LoveLife> {

    @RequestMapping(value = "/list", method = RequestMethod.GET)
    @ResponseBody
    public Object getFamilyName(String type){
        if (!type.equals("undefined")) {
            Example example = new Example(LoveLife.class);
            example.createCriteria().andEqualTo("type",Integer.parseInt(type));
            List<LoveLife> list = baseBiz.selectByExample(example);
            return   ResponseUtil.ok(list);
        } else {
            return ResponseUtil.fail(40301, "错误！");
        }

    }

}